<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
    <title>出入库明细</title>
	<%@ include file="/common/meta.jsp" %>
	<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript">
		var basic_Url="${ctx}/logic/Reports";
		var basic_WUrl="/logic/Reports";
		var basic_Title="出入库明细";
		var grid;
		function createSearch(){
			init(1,8,'80,100,80,100,80,100,80,100','5%');
			init(2,8,'80,100,80,100,80,100,80,100','5%');
			init(3,8,'80,100,80,100,80,100,80,100','5%');
			//第一行的数据
			addCommon(0,0,"lable","物料编码：");
			addCommon(0,1,"txtlike","zd005MaterialsCode");
			addCommon(0,2,"lable","物料名称：");
			addCommon(0,3,"txtlike","zd005MaterialsName");
			addCommon(0,4,"lable","PI单号：");
			addCommon(0,5,"txtlike","zd020PiCode");
			addCommon(0,6,"lable","单据类型：");
			addCommon(0,7,"selectEnum","zd002BillType","<option></option>"+
					"<option value='PSW'>采购入库</option>"+
					"<option value='BI'>多PI入库</option>"+
					"<option value='TR'>调拨</option>"+
					"<option value='CO'>其他出库</option>"+
					"<option value='CK'>其他入库</option>"+
					"<option value='PI'>成品入库</option>"+
					"<option value='SO'>成品出库</option>"+
					"<option value='MO'>领料(材料)出库</option>"+
					"<option value='RG'>退货</option>" +
					"<option value='PD'>盘点</option>" +
					"<option value='FS'>反审入库</option>");
			addCommon(1,0,"lable","单据编码：");
			addCommon(1,1,"txtlike","zd001BillCode");
			addCommon(1,2,"lable","仓库：");
 			addCommon(1,3,"selectEnum","zd003WhName","<option></option><c:forEach var="s" items="${wh}"><option value='${s.zd003Name}'>${s.zd003Name}</option></c:forEach>");
			addCommon(1,4,"lable","起始时间：");
			addCommon(1,5,"datestart","bizCreatorDate");
			addCommon(1,6,"lable","结束时间：");
			addCommon(1,7,"dateend","bizCreatorDate");
			addCommon(2,0,"lable","客户名称：");
			addCommon(2,1,"txtlike","zd022ConsumerName");
			addCommon(2,2,"lable","物品型号：");
			addCommon(2,3,"txtlike","zd007MaterialsModel");
			addCommon(2,4,"lable","物品规格：");
			addCommon(2,5,"txtlike","zd006MaterialsSpec");
		
		}
		
		function searchAP(){
			multipleSearch("#table1",true,"",basic_Url+"/InOutStorageList.do");
		}
		document.onkeydown=keyListener;   
		function keyListener(e){   
		    e = e ? e : event;  
		    if(e.keyCode == 13){   
		    	searchAP();
		    }   
		}  	
		$(function(){
			grid = $("#table1").ligerGrid({
		        columns: [
		                  { display: '单据编号', name: 'zd001BillCode', width: 100 },
		                  { display: '单据类型', name: 'zd002BillType', width: 120,render: function (item){
		                	  
		                		if(item.zd002BillType=='PSW'){
		                			return '采购入库';
		                		}else if(item.zd002BillType=='BI'){
		                			return '多PI入库';
		                		}else if(item.zd002BillType=='TR'){
		                			return '调拨';
		                		}else if(item.zd002BillType=='CO'){
		                			return '其他出库';
		                		}else if(item.zd002BillType=='CK'){
		                			return '其他入库';
		                		}else if(item.zd002BillType=='PI'){
		                			return '生产入库';
		                		}else if(item.zd002BillType=='SO'){
		                			return '销售出库';
		                		}else if(item.zd002BillType=='MO'){
		                			return '生产领料出库';
		                		}else if(item.zd002BillType=='RG'){
		                			return '退货';
		                		}else if(item.zd002BillType=='FS'){
		                			return '反审入库';
		                		}else if(item.zd002BillType=='PD'){
		                			return '盘点';
		                		}
		                  }},
		                  { display: '仓库编码', name: 'zd003WhCode', width: 100, hide:true },
		                  { display: '仓库名称', name: 'zd003WhName', width: 120},
		                  { display: '仓位编码', name: 'zd004WhLocationCode', width: 1,hide:true},
		                  { display: '仓位名称', name: 'zd004WhLocationName', width:1,hide:true},
		                  { display: '仓位ID', name: 'zd004WhLocationId', width:1,hide:true},
		                  { display: '物料编码', name: 'zd005MaterialsCode', width: 100},
		                  { display: '物料名称', name: 'zd005MaterialsName', width:120},
		                  { display: '物料型号', name: 'zd007MaterialsModel', width:120},
		                  { display: '物料规格', name: 'zd006MaterialsSpec', width:120},
		                  { display: '物料颜色', name: 'zd008MaterialsColor', width:120},
		                  { display: '物料材质', name: 'zd008MaterialsQuanlity', width:120},
		                  { display: '单位', name: 'zd009BasicUnit', width:80},
		                  { display: 'PI号', name: 'zd020PiCode', width: 120},
		                  { display: '客户名称', name: 'zd022ConsumerName', width: 120},
		                  { display: '入库数量', name: 'zd011BasicQuantity', width: 100,render: function (item){
		                		if(item.zd011BasicQuantity==''||item.zd011BasicQuantity==null||parseFloat(item.zd011BasicQuantity)==0){
		                			return '0.0';
		                		}
		                	 	return item.zd011BasicQuantity.toFixed(4);
		                }},
		                { display: '出库数量', name: 'zd010Quantity', width: 100,render: function (item){
	                		if(item.zd010Quantity==''||item.zd010Quantity==null||parseFloat(item.zd010Quantity)==0){
	                			return '0.0';
	                		}
	                	 	return item.zd010Quantity.toFixed(4);
	                		}}
		                  ],
		                  enabledEdit: true,
		                  usePager: true, rownumbers: true, 
		                  pageSize:15,
		                  pageSizeOptions :[15,25,35],
		                  url:basic_Url+"/InOutStorageList.do",
		                  width: "100%", height:'100%',
		                  enabledSort:false
		                  });
			$("#pageloading").hide();
			});
		
		//导出物料
		function exportExcel(type){
			var isOk=true;
		   	var filtersStr = generateCondition();
		   	if(isOk){
		   		isOk=false;
				var path = basic_Url+"/InOutStorageExcel.do?filters="+filtersStr+"&_search=true&type="+type;
		   	}
			window.open(path,"_blank");
		}
		</script>
	 
  </head>
 <body style="padding:10px" onload="createSearch()">  
       <div id="layout1">

          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="exportExcel(0)">导出成品Excel</button></div></div></li>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="exportExcel(1)">导出材料Excel</button></div></div></li>
				              <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
    </body>
</html>